package com.ky.course.service.impl;

import com.ky.common.param.FeedbackAdd;
import com.ky.common.vo.R;
import com.ky.course.entity.OpenCourseVideoComplaint;
import com.ky.course.mapper.OpenCourseVideoComplaintMapper;
import com.ky.course.service.OpenCourseVideoComplaintService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zpa
 * @since 2024-06-21
 */
@Service
public class OpenCourseVideoComplaintServiceImpl extends ServiceImpl<OpenCourseVideoComplaintMapper, OpenCourseVideoComplaint> implements OpenCourseVideoComplaintService {


    @Autowired
    private OpenCourseVideoComplaintMapper openCourseVideoComplaintMapper;

    @Override
    public R insertFeedback(Integer id, FeedbackAdd feedbackAdd) {

        OpenCourseVideoComplaint openCourseVideoComplaint = new OpenCourseVideoComplaint();
        openCourseVideoComplaint.setOpenCourseVideoId(feedbackAdd.getOpenCourseVideoId())
                .setUserId(id)
                .setComplaintType(feedbackAdd.getComplaintType())
                .setCreateTime(new Date())
                .setDescription(feedbackAdd.getDescription());


        return openCourseVideoComplaintMapper.insert(openCourseVideoComplaint)>0?R.ok(): R.fail("反馈失败");
    }
    /**
     * 投诉
     * @param feedbackAdd
     * @return
     */

}
